/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.ta.entity;

import org.hibernate.validator.constraints.Length;
import com.fasterxml.jackson.annotation.JsonBackReference;

import com.thinkgem.jeesite.common.persistence.TreeEntity;

/**
 * 部门信息Entity
 * @author TTAO
 * @version 2017-05-31
 */
public class StDepartment extends TreeEntity<StDepartment> {
	
	private static final long serialVersionUID = 1L;
	private String departid;		// 部门ID
	private String departName;		// 部门名称
	private StDepartment parent;		// 父部门ID
	private String orderId;		// 同级排序
	private String meno;		// 备注
	private Long operationFlag;		// 用户和部门更新时对应的操作标志位
	
	public StDepartment() {
		super();
	}

	public StDepartment(String id){
		super(id);
	}

	@Length(min=1, max=50, message="部门ID长度必须介于 1 和 50 之间")
	public String getDepartid() {
		return departid;
	}

	public void setDepartid(String departid) {
		this.departid = departid;
	}
	
	@Length(min=0, max=50, message="部门名称长度必须介于 0 和 50 之间")
	public String getDepartName() {
		return departName;
	}

	public void setDepartName(String departName) {
		this.departName = departName;
	}
	
	@JsonBackReference
	public StDepartment getParent() {
		return parent;
	}

	public void setParent(StDepartment parent) {
		this.parent = parent;
	}
	
	@Length(min=0, max=50, message="同级排序长度必须介于 0 和 50 之间")
	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}
	
	@Length(min=0, max=255, message="备注长度必须介于 0 和 255 之间")
	public String getMeno() {
		return meno;
	}

	public void setMeno(String meno) {
		this.meno = meno;
	}
	
	public Long getOperationFlag() {
		return operationFlag;
	}

	public void setOperationFlag(Long operationFlag) {
		this.operationFlag = operationFlag;
	}
	
	public String getParentId() {
		return parent != null && parent.getId() != null ? parent.getId() : "0";
	}
}